class TokenManager {
  token = null;

  setToken(token) {
    if (token) {
      this.token = token;
      localStorage.setItem("token", token);
    }
  }

  getToken() {
    if (localStorage.getItem("token")) {
      this.token = localStorage.getItem("token");
      return this.token;
    }
  }

  clearToken() {
    this.token = null;
    localStorage.setItem("token", null);
  }
}

let tokenManager = new TokenManager();
export default tokenManager;
